cmake_minimum_required(VERSION 3.0)
project(ProjectSyncedCamera)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSROOT /)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -g")

include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
include_directories(${CMAKE_SYSROOT}/opt/MVS/include)
include_directories(${CMAKE_SYSROOT}/usr/local/include/opencv4)

file(GLOB SRC_LIST ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
add_executable(turntable_scanner main.cpp ${SRC_LIST})

target_link_libraries(turntable_scanner pthread wiringPi)

file(GLOB MVS_LIBRARY ${CMAKE_SYSROOT}/opt/MVS/lib/aarch64/*.so)
if(NOT MVS_LIBRARY)
    message(FATAL_ERROR "MVS_LIBRARY not found")
endif()
target_link_libraries(turntable_scanner ${MVS_LIBRARY})

file(GLOB OPENCV_LIBRARY ${CMAKE_SYSROOT}/usr/local/lib/libopencv_*.so)
if(NOT OPENCV_LIBRARY)
    message(FATAL_ERROR "OPENCV_LIBRARY not found")
endif()
target_link_libraries(turntable_scanner ${OPENCV_LIBRARY})

